<?php
class laporan_penjualan extends My_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->database();
	}

	function index()
	{
		$this->open();
			echo '<label for="folder">folder 1</label> <input type="checkbox" id="folder" />' ;
			echo $this->menu(0,$h="");
			
		$this->close();
	}

	public function menu($parent=0,$hasil){
		$i=0;
		$w = $this->db->query("SELECT * from tbl_menu where id_parent='".$parent."'");
		if(($w->num_rows())>0)
		{
			$hasil .= '<ol>';
		}
		foreach($w->result() as $h)
		{
			$i++;
			$hasil .= '<label for="subfolder'. $i .'">Subfolder 1</label> <input type="checkbox" id="subfolder'. $i .'" />' ;
			$hasil .= "<li  class='file'>".$h->menu;
			$hasil = $this->menu($h->id_menu,$hasil);
			$hasil .= "</li>";
		}
		if(($w->num_rows)>0)
		{
			$hasil .= "</ol>";
		}
		return $hasil;
	}
}